package torres.ability;

import java.util.List;

import torres.fileIO.BasicContainer;
import torres.fileIO.ClassContainer;
import torres.fileIO.Saveable;

/**
 * @author Torres
 * Skill that Entities can use.
 *
 */
public abstract class Ability implements Saveable{
	private String name;
	private int id;
	private List<Cost> costs;
	
	
	/**
	 * Creates a new Ability with a given name.
	 * @param name Name of Ability
	 */
	public Ability(String name, int id, List<Cost> costs) {
		this.setName(name);
		this.setID(id);
		this.setCosts(costs);
		//costs = new ArrayList<Cost>(100);
	}
	
	//public abstract void useAbility();
	
	/**
	 * Sets the costs of Ability.
	 * @param costs List of new List<Cost> 
	 */
	public void setCosts(List<Cost> costs) {
		this.costs = costs;
	}
	
	/**
	 * Returns a List of Costs.
	 * @return List of type Cost
	 */
	public List<Cost> getCosts() {
		return costs;
	}
	
	/**
	 * Sets the name.
	 * @param name String for Ability name
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * Returns name
	 * @return Name of Ability
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * Save function for Ability for Save/Load.
	 * @see torres.fileIO.Saveable#save()
	 */
	@Override
	public ClassContainer save() {
		ClassContainer curClass = new ClassContainer("Ability");
		curClass.addProperty(new BasicContainer("id", id));
		
		return curClass;
	}
	
	/**
	 * Load function for Ability for Save/Load.
	 * @see torres.fileIO.Saveable#load(torres.fileIO.ClassContainer)
	 */
	@Override
	public void load(ClassContainer classContainer) {
		BasicContainer idCont = (BasicContainer)classContainer.getProperty("id");
		id = Integer.parseInt((String)idCont.getValue());
		
	}
	
	/**
	 * Returns information of Ability.
	 * @see java.lang.Object#toString()
	 * @return Name of Ability
	 */
	public String toString() {
		return "Name: " + name;
	}
	
	/**
	 * Return Ability ID
	 * @return id
	 */
	public int getID() {
		return this.id;
	}
	
	/**
	 * Sets ID of Ability
	 * @param id ID to set for Ability
	 */
	private void setID(int id) {
		this.id = id;
	}
}
